package com.service;

import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;

public class ServiceActivity extends Service {
    /** Called when the activity is first created. */
	
	private static final String TAG = "MyService" ;
	MediaPlayer player;
	
	@Override
	public IBinder onBind(Intent arg0) {
		return null;
	}
	
	
	
    @Override
    public void onCreate() {
        Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT).show();
        Log.d(TAG, "OnCreate");
        player = MediaPlayer.create(this, R.raw.braincandy);
        player.setLooping(false);// set looping
    }
    @Override
    public void onDestroy(){
    	Toast.makeText(getApplicationContext(), "servie is off", Toast.LENGTH_SHORT).show();
        Log.d(TAG, "onDestroy");
        player.stop();
    }
    @Override
	public void onStart(Intent intent, int startid){
    	Toast.makeText(getApplicationContext(), "servie is on", Toast.LENGTH_SHORT).show();
        Log.d(TAG, "onStart");
        player.start();
	}
    
    
}